package com.zzyl.mapper;

import com.zzyl.base.ResponseResult;
import com.zzyl.entity.Bed;
import com.zzyl.entity.Floor;
import com.zzyl.entity.Room;
import com.zzyl.vo.FloorVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashSet;
import java.util.List;

@Mapper
public interface FloorMapper {

    int insert(Floor floor);

    int deleteById(Long id);

    int updateById(Floor floor);

    Floor selectById(Long id);

    List<FloorVo> selectAll();

    List<FloorVo> selectAllRoomAndBed();

    List<FloorVo> selectAllByNur();
    /**
     * 根据床位状态查询获取所有楼层数据
     *
     * @param status 床位状态{@link com.zzyl.enums.BedStatusEnum}
     * @return 所有楼层数据
     */
    List<FloorVo> getRoomAndBedByBedStatus(@Param("status") Integer status);

    List<FloorVo> getFloorByCode(@Param("floorCodes") HashSet<Integer> floorNumber);

    List<Room> getRoomByDevice();

    List<Bed> getRoomByBed();

    @Select("select code from floor where id = #{floorId}")
    Integer getFloorCodeByRoom(Long floorId);

    @Select("select code from floor where id = (select floor_id from room where room.id = #{roomId})")
    Integer getFloorCodeByBed(Long roomId);
}
